package com.solution.admin.customer.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.solution.admin.customer.dao.CustomerExternalDao;
import com.solution.admin.customer.entity.CustomerExternalEntity;
import com.solution.admin.customer.service.CustomerExternalService;
import com.solution.common.dao.BaseDao;
import com.solution.common.page.PageBean;
import com.solution.common.page.PageParam;
import com.solution.common.service.impl.BaseServiceImpl;
import com.solution.common.utils.string.StringUtil;

/**
 * 客户信息扩展表service实现层
 * @author solin
 * @date 2017-09-30 14:10:53
 */
@Service
public class CustomerExternalServiceImpl extends BaseServiceImpl<CustomerExternalEntity> implements CustomerExternalService {

	/**
	 * 客户信息扩展表接口
	 */
	@Autowired
	private CustomerExternalDao customerExternalDao;

	protected BaseDao<CustomerExternalEntity> getDao() {
		return this.customerExternalDao;
	}

	/**
	 * 保存客户信息扩展表
	 * @param customerExternalEntity 客户信息扩展表实体
	 * @return Long 添加成功客户信息扩展表的ID
	 * @author solin
	 * @date 2017-09-30 14:10:53
	 */
	public long saveCustomerExternal(CustomerExternalEntity customerExternalEntity) {
		return customerExternalDao.saveCustomerExternal(customerExternalEntity);
	}

	/**
	 * 分页查询客户信息扩展表
	 * @param pageParam 分页参数
	 * @param paramMap 查询参数
	 * @return PageBean 分页参数和分页数据
	 * @author solin
	 * @date 2017-09-30 14:10:53
	 */
	@Override
	public PageBean listCustomerExternalPage(PageParam pageParam, Map<String, Object> paramMap) {
		return customerExternalDao.listCustomerExternalPage(pageParam, paramMap);
	}
	
	/**
	 * 根据ID查询用户信息
	 * @param id 用户id
	 * @return customerExternalEntity 用户对象
	 * @author solin
	 * @date 2017-09-30 14:10:53
	 */
	public CustomerExternalEntity getCustomerExternalById(Long id) {
		return customerExternalDao.getById(id.longValue());
	}

	/**
	 * 更新用户
	 * @param customerExternalEntity 用户实体
	 * @return Long 更新是否成功，>1代表更新成功
	 * @author solin
	 * @date 2017-09-30 14:10:53
	 */
	@Override
	public int updateCustomerExternal(CustomerExternalEntity customerExternalEntity) {
		return customerExternalDao.updateCustomerExternal(customerExternalEntity);
	}
	
	
	/**
	 * 根据条件查询客户信息扩展表
	 * @param param
	 * @return 数据列表
	 * @author solin
	 * @date 2017-09-30 14:10:53
	 */
	@Override
	public List<CustomerExternalEntity> listCustomerExternal( Map<String, Object> param){
		return  customerExternalDao.listCustomerExternal(param);
	}
	
	/**
	 * 删除客户信息扩展表
	 * @param 
	 * @return int 返回删除记录条数
	 * @author solin
	 * @date 2017-09-30 14:10:53
	 */
	@Override
	public int deleteCustomerExternalById(long id){
		return  customerExternalDao.deleteById(id);
	}
	
	/**
	 * 删除客户信息扩展表
	 * @param customerId 客户ID
	 * @return int 返回删除记录条数
	 * @author solin
	 * @date 2017-09-30 14:10:53
	 */
	@Override
	public int deleteCustomerExternalByCustomerId(long customerId) {
		return customerExternalDao.deleteCustomerExternalByCustomerId(customerId);
	}
	
	/**
	 * 批量插入
	 * @param list
	 * @return
	 * @author: solin
	 * @date: 2017年10月9日 下午7:12:47
	 */
	@Override
	public int batchInsertCustomerExternal(List<CustomerExternalEntity> list) {
		return customerExternalDao.batchInsertCustomerExternal(list);
	}
}
